<template>
  <div>
    <baseContainer title="基本用法">
    {{check1}}
    <x-check-box v-model="check1" @change="handleChange">checkbox</x-check-box>
    <x-check-box :indeterminate="true">checkbox</x-check-box>
    <x-check-box :disabled="true">checkbox</x-check-box>
  </baseContainer>
  <baseContainer title="多选框组">
    {{ list }}
    <x-check-box-group v-model="list">
      <x-check-box v-for="item in showList" :key="item" :label="item"></x-check-box>
    </x-check-box-group>
  </baseContainer>
  <baseContainer title="可选项目数量的限制">
    {{ list2 }}
    <x-check-box-group v-model="list2" :min="1" :max="2">
      <x-check-box v-for="item in showList2" :key="item" :label="item"></x-check-box>
    </x-check-box-group>
  </baseContainer>
  <baseContainer title="带有边框">
    <x-check-box v-model="check1" @change="handleChange" border>checkbox</x-check-box>
    <x-check-box v-model="check2" :indeterminate="true" border>checkbox</x-check-box>
    <x-check-box :disabled="true" border>checkbox</x-check-box>
  </baseContainer>
  </div>
</template>

<script lang="ts">
import { defineComponent,reactive,toRefs,ref } from 'vue'
import baseContainer from './baseContainer.vue'
export default defineComponent({
  components: {
    baseContainer
  },
  setup () {
    let state = reactive({ check1: true,check2: false })
    let list = ref(['上海', '深圳'])
    let list2 = ref(['采麻工', '枪械专家'])
    let showList = ref(['上海', '深圳', '杭州', '柏冲'])
    let showList2 = ref(['采麻工', '枪械专家', '病毒专家', '护甲工'])
    const handleChange = (val) => { 
      console.log(val, 123)
    }
    return {
      ...toRefs(state),
      handleChange,
      list,
      list2,
      showList,
      showList2
    }
  }
})
</script>

<style scoped>

</style>